#!/bin/bash

echo "Starting comprehensive database performance tests..."

# Create results dir
RESULTS_DIR="/home/data/database/test_results"
mkdir -p $RESULTS_DIR

# Run health checks
echo "=== Running Health Checks ==="
./health_check.sh

echo ""
echo "=== Running Performance Tests ==="

# Run all tests
if docker ps | grep -q opengauss; then
    echo "Testing openGauss..."
    ./test_opengauss.sh
fi

if docker ps | grep -q oceanbase-test; then
    echo "Testing OceanBase..."
    ./test_oceanbase.sh
fi

if docker ps | grep -q tdengine-test; then
    echo "Testing TDengine..."
    ./test_tdengine.sh
fi

if docker ps | grep -q matrixone-test; then
    echo "Testing MatrixOne..."
    ./test_matrixone.sh
fi

if docker ps | grep -q milvus-test; then
    echo "Testing Milvus..."
    echo "Using complete Docker-based Milvus test"
    ./test_milvus.sh
fi

echo ""
echo "=== Test Results Summary ==="
echo "Results saved to: $RESULTS_DIR"
ls -la $RESULTS_DIR/*.log

echo "All tests completed!"